package com.hangzhou.xyj.model;

import com.hangzhou.xyj.model.base.BaseModel;
import com.hyphenate.chat.EMMessage;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * Created by neo.duan on 2016/4/27.
 * 消息数据结构
 */
@DatabaseTable(tableName = "message")
public class MessageModel extends BaseModel implements Comparable<MessageModel> {
    public static final String _ID = "_id";
    public static final String UID = "_uid";
    public static final String TYPE = "_type";
    public static final String INSERT_TIME = "_insertTime";
    public static final String TITLE = "_title";
    public static final String IMAGE = "_image";
    public static final String DESC = "_desc";
    public static final String STATUS = "_status";
    public static final String UN_READ_COUNT = "_un_read_count";
    public static final String DATA0 = "_data0";
    public static final String DATA1 = "_data1";
    public static final String DATA2 = "_data2";
    public static final String DATA3 = "_data3";
    public static final String DATA4 = "_data4";
    public static final String DATA5 = "_data5";
    public static final String DATA6 = "_data6";
    public static final String DATA7 = "_data7";
    public static final String CONTENT = "_content";

    @DatabaseField(generatedId = true, columnName = _ID)
    private int id;
    @DatabaseField(columnName = UID)
    private String uid;//用户ID
    @DatabaseField(columnName = TYPE)
    private int type;// 消息类型
    @DatabaseField(columnName = INSERT_TIME)
    private long insertTime;// 消息时间
    @DatabaseField(columnName = TITLE)
    private String title;// 消息标题
    @DatabaseField(columnName = IMAGE)
    private String image; //图片
    @DatabaseField(columnName = DESC)
    private String desc;// 消息描述
    @DatabaseField(columnName = STATUS, defaultValue = "0")
    private int status;// 消息 状态
    @DatabaseField(columnName = UN_READ_COUNT)
    private int unReadCount; //未读消息数
    @DatabaseField(columnName = DATA0)
    private String data0;
    @DatabaseField(columnName = DATA1)
    private String data1;
    @DatabaseField(columnName = DATA2)
    private String data2;
    @DatabaseField(columnName = DATA3, defaultValue = "0")
    private String data3;    //消息中心标记显示字段
    @DatabaseField(columnName = DATA4)
    private String data4;
    @DatabaseField(columnName = DATA5)
    private String data5;
    @DatabaseField(columnName = DATA6)
    private String data6;
    @DatabaseField(columnName = DATA7)
    private String data7;
    @DatabaseField(columnName = CONTENT)
    private String content;//内容

    private EMMessage emMessage;


    public MessageModel() {

    }

    public MessageModel(/*String title,*/ /*String desc, */int type, long insertTime) {
//        this.title = title;
//        this.desc = desc;
        this.type = type;
        this.insertTime = insertTime;

    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public long getInsertTime() {
        return insertTime;
    }

    public void setInsertTime(long insertTime) {
        this.insertTime = insertTime;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getUnReadCount() {
        return unReadCount;
    }

    public void setUnReadCount(int unReadCount) {
        this.unReadCount = unReadCount;
    }

    public String getData0() {
        return data0;
    }

    public void setData0(String data0) {
        this.data0 = data0;
    }

    public String getData1() {
        return data1;
    }

    public void setData1(String data1) {
        this.data1 = data1;
    }

    public String getData2() {
        return data2;
    }

    public void setData2(String data2) {
        this.data2 = data2;
    }

    public String getShowStatus() {
        return data3;
    }

    public void setShownStatus(String data3) {
        this.data3 = data3;
    }


    public String getData4() {
        return data4;
    }

    public void setData4(String data4) {
        this.data4 = data4;
    }

    public String getData5() {
        return data5;
    }

    public void setData5(String data5) {
        this.data5 = data5;
    }

    public String getData6() {
        return data6;
    }

    public void setData6(String data6) {
        this.data6 = data6;
    }

    public String getData7() {
        return data7;
    }

    public void setData7(String data7) {
        this.data7 = data7;
    }

    public EMMessage getEmMessage() {
        return emMessage;
    }

    public void setEmMessage(EMMessage emMessage) {
        this.emMessage = emMessage;
    }

    @Override
    public String toString() {
        return "MessageModel{" +
                "id=" + id +
                ", uid='" + uid + '\'' +
                ", type=" + type +
                ", insertTime=" + insertTime +
                ", title='" + title + '\'' +
                ", image='" + image + '\'' +
                ", desc='" + desc + '\'' +
                ", status=" + status +
                ", unReadCount=" + unReadCount +
                '}';
    }

    @Override
    public int compareTo(MessageModel another) {
        if (this.getInsertTime() > another.getInsertTime()) {
            return -1;
        }
        return 1;
    }
}
